package com.java.service.impl;

import com.java.dao.UserMapper;
import com.java.pojo.User;
import com.java.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public User login(Integer loginName, String passWord) {
        return userMapper.login(loginName, passWord);
    }

    @Override
    public User selectByPrimaryKey(Integer loginname) {
        return userMapper.selectByPrimaryKey(loginname);
    }

    @Override
    @Transactional
    public int updatePassword(String password,int loginName) {
        Integer updatePassword = userMapper.updatePassword(password, loginName);
        if (updatePassword==null){
            return 0;
        }else {
            return updatePassword;
        }
    }
}
